/* 
 * A routine to return all the information about a param
 */

function GetCapabilityAll(a)
{
 	flashpoint();

 
  printf('# displays all parameter tag values ');
  printf('# GetProductInfo,Compability (enum, min-max, simple types )');

  printf(' ');
  
  writeMenu('"GetCapabilityAll"','"EXTRA"','"GetCapabilityAll()"');
  writeVariables();
  
  printf('<br>','#**** OPEN FILE ****');  
  printf('outFile="/System/ZCAll.txt"');
  writeFileOpen();

 	printf(' ');
 	printf('count=0 ');
	printf(' ' );
 	printf('LOOP: <br>');
 	printf(' count=count+1 ');
	printf('  ' );

	loopDisplayLineType(a);
	
	printf(' ');			
	printf(' uvar=0');
	printf(' status=GetCapabilityType(param,uvar) ');
	printf('WriteLine(fd," " )');
	
	printf(' if status!=0 ')
	printf(' goto PRODUCTINFO')
	printf(' end ');
	printf(' ');	
	printf('# Capability Type *** ');		
	printf(' if uvar == 1 ')
	printf(' goto ENUM');
	printf(' end ');
	printf(' if uvar == 2 ')
	printf(' goto MINMAX ');
	printf(' end ');
	printf(' if uvar == 3 ')
	printf(' goto SIMPLETYPE');
	printf(' end ');		

	printf('<br># MINMAX *********************** ');
	printf('MINMAX:');
    GetMinMax();
    printf('goto CONTINUE');
   
    printf('<br># ENUM List ********************* ');
    printf('ENUM: ');
    GetEnumList();
    printf('goto CONTINUE');
    
	printf('<br># SIMPLE type ******************* ');
	printf('SIMPLETYPE:');
	GetValue();
	printf('goto CONTINUE');
	
	
	printf('# PRODUCTINFO *********************** ');
	printf('PRODUCTINFO:');
	GetPInfo();
	
	printf('# end of everything !!! ');
	
	printf(' ');
	
	
    printf('CONTINUE:');
	printf('Wait(100) ');
	printf('if count <' , a.length -1);
	printf('goto LOOP ');	
	printf('end ');

	writeFileClose();
	printf('exitscript');
}


function GetMinMax()
{
	printf(' min=0' );
	printf(' max=0' );
	printf(' default=0' );
	printf(' umin=0' );
	printf(' umax=0' );
	printf(' udefault=0' );

	printf(' if theType == "UInt" ')
	printf(' status=GetCapabilitiesRange(param,umin,umax,udefault) ');
	printf(' DisplayLine(count,")",param,"[",status,"] ",udefault," (",umin,",",umax,")" ) ');
	printf(' WriteLine(fd,count,")",param,"[",status,"] ",udefault," (",umin,",",umax,")" ) ');
	printf(' end ');

 	printf(' if theType == "SInt" ')
 	printf(' status=GetCapabilitiesRange(param,min,max,default) ');
 	printf(' DisplayLine(count,")", param,"[",status,"] "," ",default," (",min,",",max,")" ) ');
 	printf(' WriteLine(fd,count,")", param,"[",status,"] "," ",default," (",min,",",max,") " ) ');
 	printf(' end ');
	
	
	printf(' if theType == "Hex" ')
	printf(' status=GetCapabilitiesRange(param,umin,umax,udefault) ');	
	printf(' bmin=umin');
	printf(' bmax=umax');
	printf(' bdefault=udefault ');
	printf(' DisplayLine(count,")",param,"[",status,"] ",bdefault,"(", bmin,",",bmax,")" )' );	
	printf(' WriteLine(fd,count,")",param,"[",status,"] ",bdefault,"(", bmin,",",bmax,")" )' );
	printf(' end');	
    printf('# MINMAX end *******************************************************');
}


function GetEnumList()
{



	printf('# PROCESS Enum List type ');
	printf(' uvar=0');
	printf(' ucount=0');
	printf(' uIndex=0');
	printf(' status=GetCapabilitiesCount(param,ucount,uvar)');
	printf(' icount = ucount ');
	printf(' icount = icount - 1');

	printf('');
	printf('ANOTHER:');

	printf(' status=GetCapabilitiesListItem(param,uIndex,sDesc,uValue) ');

	printf(' if theType == "UInt"');
	printf(' DisplayLine(count,") ",param," ","(",uIndex,")"," ",sDesc," ",uValue) ');
	printf(' WriteLine(fd,count,")",param,"[",status,"]"," (",uIndex,") ",uValue," ",sDesc) ');
	printf(' end');

	printf(' # probably "flty" ');
	printf(' if theType == "Hex"');
	printf(' bvar= uValue');
	printf(' DisplayLine(count,") ",param," ","(",uIndex,")"," ",sDesc," ",uvar) ');
	printf(' WriteLine(fd,count,")",param,"[",status,"]"," (",uIndex,") ",bvar," ",sDesc ) ');
	printf(' end');

	printf(' uValue=0 ');
	printf(' sDesc=" "');

	printf(' if uIndex < icount ');
	printf(' uIndex = uIndex + 1');
	printf(' goto ANOTHER');
	printf(' end');

}


function GetValue(a)
{

	printf(' svar="" ');
	printf(' status=GetCapabilitiesValue(param,svar) ');
	printf(' DisplayLine(count,")",param,"[",status,"] ", svar)  ');
	printf(' WriteLine(fd,count,")",param,"[",status,"] ", svar) ');


}

function GetPInfo(a)
{
	
printf('# returns in int paramter ');
printf(' ivar=0 ');
printf(' uvar=0 ');
printf(' svar=" " ');

printf(' if theType == "SInt" ');
printf(' status = GetProductInfo(param,ivar) ');
printf(' WriteLine(fd,count,")",param, "(" , status, ") ",ivar ) ');
printf(' DisplayLine(count,")",param, "(" , status, ") ",ivar ) ');
printf(' end ');
printf(' if theType == "UInt" ');
printf(' status = GetProductInfo(param,uvar) ');
printf(' WriteLine(fd,count,")",param, "(" , status, ") ",uvar ) ');
printf(' DisplayLine(count,")",param, "(" , status, ") ",uvar ) ');
printf(' end ');

printf(' if theType == "Hex" ');
printf(' status = GetProductInfo(param,uvar) ');
printf(' bvar=uvar ');
printf(' WriteLine(fd,count,")",param, "[" , status, "] ",bvar ) ');
printf(' DisplayLine(count,")",param, "[" , status, "] ",bvar ) ');
printf(' end ');


printf('# same call, but returns in string paramter ');
printf(' if theType == "String" ');
printf(' status = GetProductInfo(param,svar) ');
printf(' WriteLine(fd,count,")",param, "[" , status, "] " , svar ) ');
printf(' DisplayLine(count,")",param, "[" , status, "]" )');
printf(' DisplayLine( svar ) ');
printf(' end ' );

}

